package manong.mapper;

import manong.beans.Classes;
import manong.beans.ClassesQuery;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;
@Mapper
public interface ClassesMapper {
   
    long countByExample(ClassesQuery example);
    int deleteByExample(ClassesQuery example);

   
    @Delete({
        "delete from classes",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

   
    @Insert({
        "insert into classes (class_name, class_number, ",
        "day_limit, statu, ",
        "mark)",
        "values (#{className,jdbcType=VARCHAR}, #{classNumber,jdbcType=VARCHAR}, ",
        "#{dayLimit,jdbcType=INTEGER}, #{statu,jdbcType=INTEGER}, ",
        "#{mark,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Classes record);

    int insertSelective(Classes record);

    List<Classes> selectByExampleWithRowbounds(ClassesQuery example, RowBounds rowBounds);

    
    Classes selectOneByExample(ClassesQuery example);

    
    List<Classes> selectByExample(ClassesQuery example);

  
    @Select({
        "select",
        "id, class_name, class_number, day_limit, statu, mark",
        "from classes",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("manong.mapper.ClassesMapper.BaseResultMap")
    Classes selectByPrimaryKey(Integer id);

    
    int updateByExampleSelective(@Param("record") Classes record, @Param("example") ClassesQuery example);

  
    int updateByExample(@Param("record") Classes record, @Param("example") ClassesQuery example);


    int updateByPrimaryKeySelective(Classes record);

   
    @Update({
        "update classes",
        "set class_name = #{className,jdbcType=VARCHAR},",
          "class_number = #{classNumber,jdbcType=VARCHAR},",
          "day_limit = #{dayLimit,jdbcType=INTEGER},",
          "statu = #{statu,jdbcType=INTEGER},",
          "mark = #{mark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Classes record);

    
    int insertOrUpdate(Classes record);

   
    int insertOrUpdateSelective(Classes record);

     int batchInsert(@Param("list") List<Classes> list);

     int batchInsertSelective(@Param("list") List<Classes> list, @Param("selective") Classes.Column ... selective);
}